package com.longe.netty.decoderAndEncoder;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class NettyClientHandler extends SimpleChannelInboundHandler<Long> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Long msg) {
        System.err.println("服务器的ip = " + ctx.channel().remoteAddress());
        System.err.println("收到服务器消息 = " + msg);
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) {
        System.err.println("MyClientHandler 发送数据");
        ctx.writeAndFlush(123456L); //发送的是一个long
    }
}
